/*
 * fuseDef.c
 *
 *  Created on: 26/04/2012
 *      Author: utn_so
 */

#include "fuseDef.h"

/************************************************************************************/
/************************************************************************************/
/*									FUNCIONES	FUSE								*/
/************************************************************************************/
/************************************************************************************/

static int fsc_create(const char *path, mode_t mode, struct fuse_file_info *fi)
{
	return -ENOENT;
}

static int fsc_open(const char *path, struct fuse_file_info *fi)
{
	return -ENOENT;
}

static int fsc_read(const char *path, char *buf, size_t size, off_t offset, struct fuse_file_info *fi)
{
	(void) fi;

	return -ENOENT;

	//hay que devolver la cantidad bytes leidos
	//return retorno;

}

static int fsc_write(const char *path, const char *buf, size_t size, off_t offset, struct fuse_file_info *fi)
{
	return -ENOENT;

	//hay que devolver la cantidad de bytes escritos
	//return retorno;
}

static int fsc_release(const char *path, struct fuse_file_info *fi)
{
	//	cache
	return 0;
}

static int fsc_truncate(const char *path, off_t newsize)
{
	return -ENOENT;
}

static int fsc_unlink(const char *path)
{
	return -ENOENT;
}

static int fsc_mkdir(const char *path, mode_t mode)
{
	return -ENOENT;
}

static int fsc_readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info *fi)
{
    (void) offset;
    (void) fi;

    return 0;
}

static int fsc_rmdir(const char *path)
{
	return -ENOENT;
}

static int fsc_getattr(const char *path, struct stat *statbuf)
{
	return -ENOENT;
}

static int fsc_rename(const char *path, const char *newpath)
{
	return -ENOENT;
}

static struct fuse_operations pfs_oper = {

	.create = fsc_create,
	.open = fsc_open,
	.read = fsc_read,
	.write = fsc_write,
	//.flush = fsc_flush,
	.release = fsc_release,
	//.ftruncate = fsc_ftruncate,
	.truncate = fsc_truncate,
	.unlink = fsc_unlink,
	.mkdir = fsc_mkdir,
	.readdir = fsc_readdir,
	.rmdir = fsc_rmdir,
	//.fgetattr = pfs_fgetattr,
	.getattr = fsc_getattr,
	.rename = fsc_rename,

};

int32_t iniciarFuse(int argc, char* argv[])
{

	/*	FUSE	*/
	fuse_main(argc, argv, &pfs_oper, NULL);

	return 0;

}


